<%@page language="java" pageEncoding="UTF-8"%>
<%
        String path=request.getParameter("f");
        String prefix=request.getSession().getServletContext().getRealPath("/white_paper/");
        if(! new java.io.File(prefix+"/"+path).exists()){
%>
			<script language=javascript>
             alert('对不起，该文档不存在，我们会尽快更新!');
             window.close();
             </script>
<%        	
        }else{
	        java.io.FileInputStream fi=new java.io.FileInputStream(prefix+"/"+path);
	        java.io.BufferedInputStream br=new java.io.BufferedInputStream(fi);
			String fileSize = "0";
	        java.io.BufferedOutputStream bout=null;
			try {
	            //fi.read(b)
				//byte[] rdbyte=content.getBytes();
				//InputStream inputs=new ByteArrayInputStream(rdbyte);
				br = new java.io.BufferedInputStream(fi);
				byte[] buf = new byte[1024];
				int len = br.available();
				fileSize=String.valueOf(len);
				response.reset();
				// response.setContentType("application/octet-stream");
				response.setContentType("text/plan; charset=UTF-8");
				response.setHeader("Content-Disposition", "attachment; filename=" + path);
				response.setHeader("Content-Length", fileSize);
	            bout=new java.io.BufferedOutputStream(response.getOutputStream());
				//out = response.getOutputStream();
				bout.flush();
				while ((len = br.read(buf)) > 0)
					bout.write(buf, 0, len);
				bout.flush();
				//Avoid conflicts with response.getWriter();
				out.clear();
				out=pageContext.pushBody();
			} catch (Exception e) {
				//Logger.getLogger(this.getClass().toString()).error(e.getMessage());
				//Logger.getLogger(this.getClass().toString()).info(e.getMessage(), e);
			} finally {
				if (bout != null)
					bout.close();
				if (br != null)
					br.close();
			}
		}
%>
<!--  
	<script language=javascript>
             alert('对不起，该文档内容修改中，我们会尽快更新!');
             window.close();
             </script>
-->